package com.shop2cn.iapi.sqdistributor.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.shop2cn.iapi.sqdistributor.parameter.request.GetParentDistributorTypeReq;
import com.shop2cn.iapi.sqdistributor.service.GetParentDistributorTypeCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.tag.P1;

public class Ts_GetParentDistributorType {
	
	//java接口
	private static GetParentDistributorTypeReq getParentDistributorTypeReq;
	private static GetParentDistributorTypeCall getParentDistributorTypeCall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("获取指定分销员的上级分销员的类型");
	}

	@Before
	public void caseUp() {
		getParentDistributorTypeReq = new GetParentDistributorTypeReq();
		getParentDistributorTypeCall = new GetParentDistributorTypeCall();	
	}
	
	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getParentDistributorTypeCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetParentDistributorType_001() {
		Logger.start(true, "上级是分销员");
		
		try {
			
			getParentDistributorTypeReq.setDistributorId(1163307794L);
			
			getParentDistributorTypeCall.setData(getParentDistributorTypeReq);
			getParentDistributorTypeCall.callService();
			
			Logger.verifyEquals(true, getParentDistributorTypeCall.getSuccess(), "验证success");
			Logger.verifyEquals(0, getParentDistributorTypeCall.getDistributorType(), "验证DistributorType");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetParentDistributorType_002() {
		Logger.start(true, "上级是分销机构");
		
		try {
			
			getParentDistributorTypeReq.setDistributorId(58082709L);
			
			getParentDistributorTypeCall.setData(getParentDistributorTypeReq);
			getParentDistributorTypeCall.callService();
			
			Logger.verifyEquals(true, getParentDistributorTypeCall.getSuccess(), "验证success");
			Logger.verifyEquals(1, getParentDistributorTypeCall.getDistributorType(), "验证DistributorType");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}
